package com.jay.lang.reflect.intf;

import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.List;

public class ParameterizedTypeIntf {

	public static void main(String[] args) throws NoSuchMethodException,
			SecurityException {
		Method getPayments = ParameterizedTypeIntf.class.getMethod(
				"getPayments", new Class[] { String[].class, List.class });
		Type[] types = getPayments.getGenericParameterTypes();
		if (types[1] instanceof ParameterizedType) {
			System.out
					.println("The second parameter of this method is ParameterizedType.");
			ParameterizedType gType = (ParameterizedType) types[1];
			System.out.println(gType.getActualTypeArguments()[0]);
			System.out.println(gType.getOwnerType());
			System.out.println(gType.getRawType());
		}
	}

	public String[] getPayments(String[] payments, List<String> products) {
		return payments;
	}

}
